<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Payroll Wizard</title>
<script type="text/javascript" src="/js/jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="/js/jquery-ui-1.8.21.custom.min.js"></script>
<script type="text/javascript" src="/js/jquery.leanModal.min.js"></script>
<link type="text/css" href="/css/start/jquery-ui-1.8.21.custom.css" rel="Stylesheet" />	
<script language="javascript"> 
function transfer(date_begin,date_end){
	window.location.href = 'http://<?php echo WEB_IP?>/rosteraudit/payroll-wizard-opening-case/date_begin/'+ date_begin + '/date_end/' + date_end + '/next/yes';
}
</script>
</head>

<body style="font-family:Arial, Helvetica, sans-serif">
<?php $leave = new Model_Hr_Staffleave();
	  $stfD = new Model_DbTable_Roster_Stafflogindetail();
      $leaveType = unserialize(LEAVE_TYPE);
      $payType = unserialize(PAYROLL_TYPE);?>
<h1>Payroll Wizard Calculate Leave</h1>
<h2>Payroll ( <?php echo $this->dateBegin;?> ~ <?php echo $this->dateEnd;?> )</h2>
<form action = "" method = "post">
	<h3>Annual Leave List (Total <?php echo count($this->leaveList);?>)</h3>
	<?php if($this->link){
		echo $this->link."<br/>";?>
	
	<?php }?>
	<a href = "<?php echo WEB_IP?>/roster/add-roster-in-leave/dateBegin/<?php echo $this->dateBegin ?>/dateEnd/<?php echo $this->dateEnd?>" target = "_blank" >Check Staff Login During Leave</a><br/><br/>
	<input type = "submit" id = "export_file" name = "export_file" value = "Export File"></input> 
	<br/>
	<br/>
	
	<h3>Cash</h3>
	<table border="1" cellspacing="0" cellpadding="2" style="font-size:12px;">
		<tr>
   			<td style="width:120px;">Staff</td>
    		<td style="width:150px;">Leave Type</td>
    		<td style="width:100px;">Leave Date</td>
    		<td style="width:100px;">Time</td>
    		<td style="width:100px;">Hour</td>
    		<td style="width:100px;">Payment Type</td>
    		<td style="width:100px;">Approve By</td>
		</tr>
		<?php foreach($this->leaveList as $k => $v){
				$leaveDetail = $leave->getApproveLeaveByIdDate($v['staff_id'], $v['leave_date']);
				if($v['id_package'] == 2 || $v['id_package'] == 5){
				$appStf = $stfD->getDetail($leaveDetail['approved_id_staff']);?>
			<tr>
				<td><?php echo $v['first_name']." ".$v['last_name']."(".$v['ni'].")";?></td>
				<td><?php echo $leaveType[$leaveDetail['period_type']];?></td>
				<td><?php echo $v['leave_date'];?></td>
				<td><?php echo $v['time_begin']." ~ ".$v['time_end'];?></td>
				<td><?php echo $v['hour']?></td>
				<td><?php echo 'Cash'?></td>
				<td><?php echo $appStf['ni']?></td>
			</tr>
			<?php 
		    }}?>
	</table>
	
	<h3>Bank</h3>
	<table border="1" cellspacing="0" cellpadding="2" style="font-size:12px;">
		<tr>
   			<td style="width:120px;">Staff</td>
    		<td style="width:150px;">Leave Type</td>
    		<td style="width:100px;">Leave Date</td>
    		<td style="width:100px;">Time</td>
    		<td style="width:50px;">Hour</td>
    		<td style="width:100px;">Payment Type</td>
    		<td style="width:100px;">Approve By</td>
		</tr>
		<?php foreach($this->leaveList as $k => $v){
				$leaveDetail = $leave->getApproveLeaveByIdDate($v['staff_id'], $v['leave_date']);
				if($v['id_package'] != 2 && $v['id_package'] != 5){
				$appStf = $stfD->getDetail($leaveDetail['approved_id_staff']);?>
			<tr>
				<td><?php echo $v['first_name']." ".$v['last_name']."(".$v['ni'].")";?></td>
				<td><?php echo $leaveType[$leaveDetail['period_type']];?></td>
				<td><?php echo $v['leave_date'];?></td>
				<td><?php echo $v['time_begin']." ~ ".$v['time_end'];?></td>
				<td><?php echo $v['hour']?></td>
				<td><?php echo 'Bank'?></td>
				<td><?php echo $appStf['ni']?></td>
			</tr>
			<?php 
		    }}?>
	</table>

	
	


</form>
<br/>
<input type = "submit" id = "next" name = "next" value = "Next" style = "margin-left:700px"onclick= "transfer('<?php echo $this->dateBegin;?>','<?php echo $this->dateEnd;?>')"></input>


</body>
</html>
